import QtQuick 1.1
import com.nokia.symbian 1.1

Page{
    id: root

    signal colorSelected(color color)


    property list<QtObject> colorModel:[
        ColorObject{colorOption: "white"},
        ColorObject{colorOption: "black"},
        ColorObject{colorOption: "red"},
        ColorObject{colorOption: "darkRed"},
        ColorObject{colorOption: "green"},
        ColorObject{colorOption: "darkGreen"},
        ColorObject{colorOption: "blue"},
        ColorObject{colorOption: "darkBlue"},
        ColorObject{colorOption: "cyan"},
        ColorObject{colorOption: "darkCyan"},
        ColorObject{colorOption: "magenta"},
        ColorObject{colorOption: "darkMagenta"},
        ColorObject{colorOption: "yellow"},
        ColorObject{colorOption: "gray"},
        ColorObject{colorOption: "darkGray"},
        ColorObject{colorOption: "lightGray"}
    ]

    Component{
        id: colorDelegate
        Rectangle{
            width: gridView.cellWidth
            height: gridView.cellHeight
            border.color: "white"
            border.width: 5

            Rectangle{
                id: colorRect
                anchors.margins: 5
                anchors.fill: parent
                color: colorOption
                radius: 5
            }
            MouseArea{
                anchors.fill: parent
                onClicked: {
                    root.colorSelected(colorRect.color)
                    pageStack.pop();
                }
            }
        }
    }

    GridView{
        id: gridView
        anchors.fill: parent
        delegate: colorDelegate
        focus: true
        model: colorModel
        cellWidth: (width/3)-0.5
        cellHeight: cellWidth
    }
}

